package edu.sctu.practice.class02.shuqiqi.assign.assign02;

/**
 * Created by admin on 2015/10/10.
 */
public class Rational {

    public int a, b;//定义变量a、b;

    public double add, subtract, multiply, divide;

    //构造方法，为a、b两个变量赋值；
    public Rational(int a, int b) {
        this.a = a;
        this.b = b;
    }

    //定义加法方法；
    public double add() {
        add = a + b;//加法
        return add;
    }

    //定义减法方法；
    public double subtract() {
        subtract = a - b;//减法
        return subtract;
    }

    //定义乘法方法；
    public double multiply() {
        multiply = a * b;//乘法
        return multiply;
    }

    //定义除法方法；
    public double divide() {
        divide = a / b;//除法
        return divide;
    }

}
